<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
	<style type="text/css">
		 body{
		 	 background: #455A64 url() 0 0 no-repeat;
		 }
		*{
			margin: 0px;
			padding:0px;
		}
		li{
			list-style: none;
		}
		.box{
			width: 420px;
			height: 330px;
			background: red url() 0 0 no-repeat;
			margin: 100px auto;
			color: #fff;
		}
		.top{
			width: 100%;
			height: 40px;
			background: #fff url() 0 0 no-repeat;
		}

		.title{
			float: left;
			color: #000;
			width: 84px;
			line-height: 40px;
			text-align: center;
			background: #F5F5F5 url() 0 0 no-repeat;
			cursor: pointer;
		}
		.top .active{
			background: #80B600 url() 0 0 no-repeat;
			color: #fff;
		}
		.main{
			width: 100%;
			height: 290px;
			position: relative;
		}

		.content{
			width: 100%;
			height: 290px;
			position: absolute;
			top: 0px;
			left: 0px;
			background: #80B600 url() 0 0 no-repeat;
			text-align: center;
			line-height: 290px;
			font-size: 40px;
			display: none;
		}
		.main .active{
			display: block;
		}

		

	</style>
	<script type="text/javascript">
		$(function  () {

			$('.top li').click(function(event) {
				index = $(this).index();
				num =index;
				run();
			});


			time = setInterval(run, 5000);

			num = 0
			function run () {
				$('.top li').eq(num).addClass('active').siblings().removeClass('active');
				$('.main li').eq(num).show().siblings().hide();

				if(num==($('.top li').length-1)){
					num=0;
				}else{
					num++;
				}
			}

			$('.box').hover(function() {
				clearInterval(time)
			}, function() {
				time = setInterval(run, 5000);
			});
		})
	</script>
</head>
<body>
	<div class="box">
		<ul class="top">
			<li class="title active">tab1</li>
			<li class="title">tab2</li>
			<li class="title">tab3</li>
			<li class="title">tab4</li>
			<li class="title">tab5</li>
		</ul>
		<ul class="main">
			<li class="content active">content1</li>
			<li class="content">content2</li>
			<li class="content">content3</li>
			<li class="content">content4</li>
			<li class="content">content5</li>
		</ul>
	</div>
</body>
</html>